<?php

class Zend_View_Helper_PeriodElement extends Zend_View_Helper_FormElement
{
    protected $html = '';
    public function periodElement($name, $value = null, $attribs = null)
    {
    	$MONTHS = array("Jan"=>"Jan","Feb"=>"Feb","Mar"=>"Mar","Apr"=>"Apr",
    					"May"=>"May","Jun"=>"Jun","Jul"=>"Jul","Aug"=>"Aug",
    					"Sep"=>"Sep","Oct"=>"Oct","Nov"=>"Nov","Dec"=>"Dec");
    	
    	$YEAR = array();
    	
    	$currentYear = date("Y");
    	
    	for($startY=2013;$startY<=$currentYear;$startY++) {
    		$YEAR[$startY] = $startY;
    	}
    	
        $month = $year = '';
        if (!empty($value)){
        	list($month, $year) = split('-',$value);
        }

        $helper = new Zend_View_Helper_FormSelect();
        $helper->setView($this->view);
        
        $this->html .= $helper->formSelect($name . '[month]', $month, null, $MONTHS);
        $this->html .= '&nbsp;&nbsp;';
        $this->html .= $helper->formSelect($name . '[year]', $year, null, $YEAR);
       
        return $this->html;
    }

}

